//
//  SettingPwdCell.m
//  CBT
//
//  Created by Mr.Zhang on 2018/11/21.
//  Copyright © 2018 Mr.Zhang. All rights reserved.
//

#import "SettingPwdCell.h"

@interface SettingPwdCell()

@property (nonatomic, strong) UILabel *leftLabel;
@property (nonatomic, strong) UIImageView *rightImageView;
@property (nonatomic, strong) UIView *lineView;

@end

@implementation SettingPwdCell

- (void)awakeFromNib {
    [super awakeFromNib];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self initSubViews];
    }
    return self;
}

-(void)setTitleText:(NSString *)titleText
{
    _leftLabel.text = kLocalizedString(titleText, nil);
}

- (void)initSubViews
{
    _rightImageView = [[UIImageView alloc]init];
    _rightImageView.image = [UIImage imageNamed:@"mine_next"];
    [self.contentView addSubview:_rightImageView];
    
    _leftLabel = [[UILabel alloc]init];
    _leftLabel.textColor = UIColorFromRGB(0x333333);
    _leftLabel.font = [UIFont systemFontOfSize:15];
    [self.contentView addSubview:_leftLabel];
    
    _lineView = [[UIView alloc]init];
    _lineView.backgroundColor = UIColorFromRGB(0xE6E9F7);
    [self.contentView addSubview:_lineView];
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    
    __weak typeof(self) weakSelf = self;
    [_rightImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_offset(-15);
        make.width.mas_equalTo(5);
        make.height.mas_equalTo(9);
        make.top.mas_equalTo(25);
    }];
    
    [_leftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(23);
        make.right.lessThanOrEqualTo(weakSelf.rightImageView).offset(-23);
        make.top.bottom.offset(0);
    }];
    
    [_lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(15);
        make.right.mas_offset(-15);
        make.bottom.offset(0);
        make.height.mas_offset(0.5);
    }];
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

@end
